{% extends 'core/party/index.html' %}

{% load i18n staticfiles %}

{% block 'scripts' %}
    <script src="{% static 'js/party_dashboard.js' %}"></script>
{% endblock %}

{% block 'subcontent' %}
    <div class="row">
        <div class="col-md-4">
            <a href="{% url 'party_politician_add' user.username %}" class="dashboard-link">
                <div class="panel panel-primary dashboard-item">
                    <div class="panel-heading">
                        <i class="fa fa-plus-square fa-5x"></i>
                    </div>
                    <p>{% trans 'add_politician' %}</p>
                </div>
            </a>
        </div>
        <div class="col-md-4">
            <a href="{% url 'party_export' user.username %}" class="dashboard-link">
                <div class="panel panel-primary dashboard-item">
                    <div class="panel-heading">
                        <i class="fa fa-table fa-5x"></i>
                    </div>
                    <p>{% trans 'export' %}</p>
                </div>
            </a>
        </div>
        <div class="col-md-4">
            <a href="{% url 'party_logout' user.username %}" class="dashboard-link">
                <div class="panel panel-primary dashboard-item">
                    <div class="panel-heading">
                        <i class="fa fa-sign-out fa-5x"></i>
                    </div>
                    <p>{% trans 'logout' %}</p>
                </div>
            </a>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    {% trans 'created_politicians' %}
                </div>
                <table class="panel-body table table-striped">
                    <thead>
                        <tr>
                            <th class="col-md-4">{% trans 'first_name' %}</th>
                            <th class="col-md-4">{% trans 'last_name' %}</th>
                            <th class="col-md-3 hidden-xs">{% trans 'state' %}</th>
                            <th class="col-md-1 text-right"></th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for politician in politicians %}
                        <tr>
                            <td class="col-md-4">{{politician.first_name}}</td>
                            <td class="col-md-4">{{politician.last_name}}</td>
                            <td class="col-md-3 hidden-xs">{{politician.state_name}}</td>
                            <td class="col-md-1 text-right">
                                <a href="#" class="clipboard" data-clipboard-text="{{politician.unique_url}}" title="{% trans 'copy_to_clipboard' %}"><i class="fa fa-copy"></i></a>
                                <a href="{% url 'party_politician_edit' party_name=user.username politician_id=politician.id %}" title="{% trans 'edit_politician' %}"><i class="fa fa-pencil"></i></a>
                                <a href="{% url 'party_politician_delete' party_name=user.username politician_id=politician.id %}" title="{% trans 'delete_politician' %}"><i class="fa fa-trash"></i></a>
                            </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="modal fade clipboard-modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <label for="#url">{% trans 'copy_url_text' %}:</label>
                    <input class="form-control" id="url" type="text" value="" readonly style="cursor:auto;">
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary" data-dismiss="modal">{% trans 'close' %}</button>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
